using System;

namespace OpenComposite.Base
{
	#region Event Arguments / Handler

	#region Int Event

	/// <summary>
	/// Integer Event Argument for the IntEventHandler
	/// </summary>
	public class IntEventArgs : System.EventArgs
	{
		private readonly int m_int;

		/// <summary>
		/// Initialize IntEventArgs.
		/// </summary>
		/// <param name="iIntArg">Integer Value</param>
		public IntEventArgs(int iIntArg)
		{
			m_int = iIntArg;
		}
		/// <summary>
		/// Gets the Integer Value.
		/// </summary>
		public int IntArg
		{
			get { return m_int; }
		}
	}
	/// <summary>
	/// EventHandler with IntEventArgs
	/// </summary>
	public delegate void IntEventHandler(object sender, IntEventArgs e);

	#endregion

	#region String Event

	/// <summary>
	///  String Event Argument for the StringEventHandler
	/// </summary>
	public class StringEventArgs : System.EventArgs
	{
		private readonly string m_str;
		/// <summary>
		/// Initialize StringEventArgs.
		/// </summary>
		/// <param name="sStringArg">String Value</param>
		public StringEventArgs(string sStringArg)
		{
			m_str = sStringArg;
		}
		/// <summary>
		/// Gets the String Value
		/// </summary>
		public string StringArg
		{
			get { return m_str; }
		}
	}

	/// <summary>
	/// EventHandler with StringEventArgs
	/// </summary>
	public delegate void StringEventHandler(object sender, StringEventArgs e);

	#endregion

	/// <summary>
	/// Simple generic EventArgs for events with one argument.
	/// </summary>
	/// <typeparam name="T">Argument Type</typeparam>
	public class EventArgs<T> : EventArgs
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="EventArgs&lt;T&gt;"/> class.
		/// </summary>
		/// <param name="arg">The argument.</param>
		public EventArgs(T arg)
		{
			_argument = arg;
		}

		private T _argument;

		/// <summary>
		/// Gets or sets the argument.
		/// </summary>
		/// <value>The argument.</value>
		public T Argument
		{
			get { return _argument; }
			set { _argument = value; }
		}
	}

	/// <summary>
	/// Simpe generic EventArgs for events with two arguments.
	/// </summary>
	/// <typeparam name="T">First argument type</typeparam>
	/// <typeparam name="U">Second argument type</typeparam>
	public class EventArgs<T, U> : EventArgs<T>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="EventArgs&lt;T, U&gt;"/> class.
		/// </summary>
		/// <param name="arg1">The first argument.</param>
		/// <param name="arg2">The second argument.</param>
		public EventArgs(T arg1, U arg2)
			: base(arg1)
		{
			_argument2 = arg2;
		}

		private U _argument2;

		/// <summary>
		/// Gets or sets the second argument.
		/// </summary>
		/// <value>The second argument.</value>
		public U Argument2
		{
			get { return _argument2; }
			set { _argument2 = value; }
		}
	}

	#endregion
}
